<%@page import="wt.session.SessionServerHelper"%>
<%@page import="wt.vc.VersionReference"%>
<%@page import="wt.vc.Iterated"%>
<%@page import="ext.tianma.upload.MyUtil"%>
<%@page import="wt.workflow.work.WorkItem"%>
<%@page import="wt.fc.ReferenceFactory"%>
<%@page import="wt.fc.QueryResult"%>
<%@page import="wt.fc.WTObject"%>
<%@page import="org.json.JSONObject"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="wt.method.RemoteMethodServer,
	                 ext.workflow.WorkFlowUtil,
					 java.util.*,
					 java.lang.*,
					 wt.project.*,
					 wt.workflow.engine.*,
					 wt.org.*
					 "%>
<!DOCTYPE HTML>
<%
String wid = request.getParameter("wid");
WfProcess process = MyUtil.GetWfProcess(wid);
System.out.println("----process-----" + process);
WfVariable VariableMainType = process.getContext().getVariable("businessType");
System.out.println("----VariableMainType-----" + VariableMainType);

String businessType = VariableMainType.getValue().toString();

String path = request.getContextPath();
String docKey = request.getParameter("docKey");
String oid = request.getParameter("oid");

JSONObject obj = new JSONObject();
if("xxPart".equals(businessType)) {
	System.out.println("----xxpart-----");
	String radio0 = request.getParameter("radio0");
	
	obj.put("radio0", radio0);
} else if("gkPart".equals(businessType)) {
	String bt = request.getParameter("bt");
	String cs = request.getParameter("cs");
	String bcs = request.getParameter("bcs");
	System.out.println("----common upload-----"+bcs);
	String b1t1 = request.getParameter("b1t1");
	String b1t2 = request.getParameter("b1t2");
	String b2t1 = request.getParameter("b2t1");
	String b2t2 = request.getParameter("b2t2");
	String radio2 = request.getParameter("radio2");
	String radio4 = request.getParameter("radio4");
	String radio5 = request.getParameter("radio5");
	String radio6 = request.getParameter("radio6");
	String radio7 = request.getParameter("radio7");
	String radio8 = request.getParameter("radio8");

	obj.put("bt", bt);
	obj.put("cs", cs);
	obj.put("bcs", bcs);
	obj.put("b1t1", b1t1);
	obj.put("b1t2", b1t2);
	obj.put("b2t1", b2t1);
	obj.put("b2t2", b2t2);
	obj.put("radio2", radio2);
	obj.put("radio4", radio4);
	obj.put("radio5", radio5);
	obj.put("radio6", radio6);
	obj.put("radio7", radio7);
	obj.put("radio8", radio8);
} else if("czPart".equals(businessType)) {
	String bt = request.getParameter("bt");
	String cs = request.getParameter("cs");
	String bcs = request.getParameter("bcs");
	String b1t1 = request.getParameter("b1t1");
	String b1t2 = request.getParameter("b1t2");
	String b2t1 = request.getParameter("b2t1");
	String b2t2 = request.getParameter("b2t2");
	String radio2 = request.getParameter("radio2");
	String radio4 = request.getParameter("radio4");
	String radio5 = request.getParameter("radio5");
	String radio6 = request.getParameter("radio6");
	String radio7 = request.getParameter("radio7");
	String radioD1 = request.getParameter("radioD1");
	String radioD2 = request.getParameter("radioD2");
	String radioD3 = request.getParameter("radioD3");

	obj.put("bt", bt);
	obj.put("cs", cs);
	obj.put("bcs", bcs);
	obj.put("b1t1", b1t1);
	obj.put("b1t2", b1t2);
	obj.put("b2t1", b2t1);
	obj.put("b2t2", b2t2);
	obj.put("radio2", radio2);
	obj.put("radio4", radio4);
	obj.put("radio5", radio5);
	obj.put("radio6", radio6);
	obj.put("radio7", radio7);
	obj.put("radioD1", radioD1);
	obj.put("radioD2", radioD2);
	obj.put("radioD3", radioD3);
}

String values = obj.toString();

System.out.println("----jsp values----"+values);
System.out.println("----jsp wid----"+wid);
%>


<html>
<head>
<title>文档上传</title>
<style type="text/css">
self.resizeTo(650,520);   
self.focus();

body, html{
     background:#ddecf5;
     width: 90%;
     height: 90%;
}  

#box1{
    background-color: white;
	height: 105%;
    width: 114%;
	padding-top: 4%;
	margin-top: 4%;
	margin-left: 3%;
}  

#box2 {
    height: 100px;
    position: absolute;
    left: 45%;
    top: 50%;
    margin: -13% -23%;
    padding-top: 11%;
}

#box3{
    text-align: center;
}
#submitButton{
    width: 90px;
	height: 30px;
	margin-top: 27%;
	margin-left: 93%;
}

</style>
</head>

<body>

   <script type="text/javascript">   
    self.resizeTo(650,520);   
    self.focus();   
   </script>

	<script type="text/javascript">
	
        function check() {
            var str = document.getElementById("fileName").value;
            if (str == "") {
                alert("上传文档不能为空！");
            } else {
                var url = '<%=path %>/netmarkets/jsp/upload/commonHandle.jsp?wid=<%=wid %>&docKey=<%=docKey %>&values=<%=values %>';
                document.getElementById('uploadform').action = url;
                document.getElementById('uploadform').submit();
                document.getElementById("box2").innerText="正在导入，请稍候......";
                
            }

        }
       
    </script>


	<div id="box1">
	<form id="uploadform" method="POST" ENCTYPE="multipart/form-data">
		<div id="box2">
		
		  <span>请选择文件：</span>
		  <span><input id="fileName" name="fileName" size="30" type="file"
                        style=" height: 25px" onchange="check()">
          </span>
			
			<!-- 
			<div id="box3">
			     <input id="submitButton"
                        type="button" size="30" value="上传"
                        onclick="check()">
			</div> 
			-->
		</div>

		
	</form>
	</div>
	
	
</body>
</html>